<?php

namespace backend\models;

use Yii;

/**
 * This is the model class for table "edu_feedback".
 *
 * @property int $id
 * @property int $user_id 用户id
 * @property string $desc 问题描述
 * @property string $contact 联系方式
 * @property int $create_time 创建时间
 * @property int $status 处理结果
 */
class EduFeedback extends \yii\db\ActiveRecord
{

    public $create_time_start;
    public $create_time_end;

    //定义只有两种状态的枚举
    const STATUS_DISABLE = 0; //未处理
    const STATUS_ENABLE = 1; //已经处理

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return 'edu_feedback';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['user_id', 'create_time', 'status'], 'integer'],
            [['desc', 'create_time_end', 'create_time_start'], 'string'],
            [['create_time', 'create_time_start'], 'safe'],
            [['contact'], 'string', 'max' => 50],
        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'user_id' => 'User ID',
            'desc' => '内容',
            'contact' => '联系方式',
            'create_time' => '时间',
            'create_time_start' => '开始时间',
            'create_time_end' => '结束时间',
            'status' => '状态',
        ];
    }

    /**
     * @return array
     * 获取状态
     */
    public static function allStatus()
    {
        return ['' => '', self::STATUS_ENABLE => '已处理', self::STATUS_DISABLE => '未处理'];
    }

}